package com.aiks.single.singlemavenproject.controller.user;

import com.aiks.single.singlemavenproject.common.CommonResult;
import com.aiks.single.singlemavenproject.entity.CustomUser;
import com.aiks.single.singlemavenproject.service.UserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 用户相关接口.
 *
 * @author <a href="mailto:yuanz@yxt.com">yuanz</a>
 * @date 2022-01-27 11:13
 * @since 1.0.0
 **/
@RestController
@RequestMapping("/api/user")
public class UserController {
    @Resource
    private UserService userService;
    
    /**
     * 查询用户.
     *
     * @param id 主键
     * @return CommonResult
     */
    @GetMapping("/{id}")
    public CommonResult<CustomUser> getCustomUser(@PathVariable("id") Long id) {
        CustomUser customUser = userService.getCustomUser(id);
        return CommonResult.ok(customUser);
    }
}
